clear all
import spss using /Users/tatianapaula/Desktop/My paper project/Data analysis/Survey A Cara da Democracia/2020/bdacara20_A Cara da Democracia 2020.sav", clear
gen year = 2020
keep sexo idade sit gc5 _v2 rcor esc partsimp relig satdem year
gen female = (sexo==2)
gen male = (sexo==1)
rename idade age
rename gc5 TrustArmedForces
rename _v2 income
drop if TrustArmedForces>5
label variable TrustArmedForces
label define labels26 1 High 2 Medium 3 Low 4 DontTrust, modify
drop if TrustArmedForces>5
label define labels26 1 High 2 Medium 3 Low 4 DontTrust, modify
label define labels45 1 YES 2 NO, modify
gen DontTrust=1 if TrustArmedForces==3 | TrustArmedForces==4
replace DontTrust=0 if TrustArmedForces==1 | TrustArmedForces==2
gen white = rcor==3
gen black = rcor==1
gen other_race = rcor==2  | rcor==4 | rcor==5
gen grade12 = esc==1 | esc==2 | esc==3
gen grade13 = esc==2 | esc==3 | esc==4 | esc==5 | esc==6 
label variable partsimp "Currently likes one political party"
rename relig religion
label variable religion "religion"
gen Dissatisfaction=1 if satdem==3 | satdem==4
replace Dissatisfaction=0 if satdem==1 | satdem==2
drop if religion>11
save "/Users/tatianapaula/Desktop/My paper project/Data analysis/logit regression/2020", replace

logit DontTrust Dissatisfaction white female age i.schooling partsimp i.religion i.income, or

collect clear
collect create MyModels

collect _r_b _r_p,                    ///
        name(MyModels)                 		    ///
        tag(model[(1)])                			///
        :logit DontTrust Insatisfaction white female age i.schooling partsimp i.religion i.income, or

collect layout (colname#result) (model), name(MyModels)
collect style cell cell_type[item column-header], halign(center)
collect style header result, level(hide)
collect style column, extraspace(1)
putpdf clear
putpdf begin
collect style putpdf, width(60%) indent(1 in)                                ///
        title("Table 1: Likelihood of lower level of trust in Armed Forces if the repsondent is insatisfied with Democracy in Brazil (A Cara da Democracia - 2018)") ///
        note("Standardized coefficients presented in OLS models; Odds ratios presented in Logits (p-values in parentheses)")
putpdf collect
putpdf save MyTable3.pdf, replace

